Add patch to help build system find numpy headers
authorStuart Prescott <stuart@debian.org>
Tue, 7 May 2024 11:22:21 +0000 (21:22 +1000)
committerStuart Prescott <stuart@debian.org>
Tue, 7 May 2024 11:22:21 +0000 (21:22 +1000)
debian/patches/0005-Fix-numpy-header-detection.patch [new file with mode: 0644]
debian/patches/series

diff --git a/debian/patches/0005-Fix-numpy-header-detection.patch b/debian/patches/0005-Fix-numpy-header-detection.patch
new file mode 100644 (file)
index 0000000..a901862
--- /dev/null
@@ -0,0 +1,29 @@
+From: Stuart Prescott <stuart@debian.org>
+Date: Tue, 7 May 2024 10:06:59 +1000
+Subject: Fix numpy header detection
+
+Existing code makes assumptions about site-packages/dist-packages
+and fails to find the headers; numpy has an explicit function for this
+---
+ build_scripts/utils.py | 8 ++------
+ 1 file changed, 2 insertions(+), 6 deletions(-)
+
+diff --git a/build_scripts/utils.py b/build_scripts/utils.py
+index 1ee3e39..e870fb2 100644
+--- a/build_scripts/utils.py
++++ b/build_scripts/utils.py
+@@ -68,12 +68,8 @@ def update_env_path(newpaths):
+ def get_numpy_location():
+-    for p in sys.path:
+-        if 'site-' in p:
+-            numpy = Path(p).resolve() / 'numpy'
+-            if numpy.is_dir():
+-                return os.fspath(numpy / 'core' / 'include')
+-    return None
++    import numpy
++    return numpy.get_include()
+ def platform_cmake_options(as_tuple_list=False):
index 520f95842f38696ab14ade5cdb249de37ec6a559..e4a759fba8be2a9f8715fb4702c23e47dde70cdc 100644 (file)
@@ -2,3 +2,4 @@
 0002-disable-qtexampleicons.patch
 0003-Fix-missing-subparser-in-test-harness.patch
 0004-Add-failing-tests-to-blacklist.patch
+0005-Fix-numpy-header-detection.patch